﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrandwayLib.Meters.Interfaces
{
    /// <summary>
    /// 衰减器接口
    /// </summary>
    public interface IAttenuation
    {
        /// <summary>
        /// 衰减器名称
        /// </summary>
        string Name { get; }

        /// <summary>
        /// 连接的参数类型
        /// </summary>
        Type ParamType { get; }

        /// <summary>
        /// 连接参数
        /// </summary>
        object ConnectParam { set; get; }

        /// <summary>
        /// 是否已连接
        /// </summary>
        bool IsConnected { get; }

        /// <summary>
        /// 连接后异常断开产生事件
        /// </summary>
        event EventHandler BreakConnect;

        /// <summary>
        /// 连接衰减器
        /// </summary>
        /// <returns>是否连接成功</returns>
        bool Connect();

        /// <summary>
        /// 断开衰减器
        /// </summary>
        void DisConnect();

        /// <summary>
        /// 切换波长
        /// </summary>
        /// <param name="wavelength">波长</param>
        /// <returns>是否切换成功</returns>
        bool ChangeWavelength(int wavelength);

        /// <summary>
        /// 调节衰减功率
        /// </summary>
        /// <param name="atten">衰减值</param>
        /// <returns>是否调节成功</returns>
        bool AdjustAtten(double atten);

        /// <summary>
        /// 获取当前衰减值
        /// </summary>
        /// <returns>当前衰减值</returns>
        double GetAttenValue();
    }
}
